<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /Users/paulross/dev/Python-3.6.2/Include/memoryobject.h</title>
  </head>
  <body>
    <h1>File: /Users/paulross/dev/Python-3.6.2/Include/memoryobject.h</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="True">       1:</span> <span class="k">/* Memory view object. In Python this is available as &quot;memoryview&quot;. */</span>
<a name="2" /><span class="True">       2:</span> 
<a name="3" /><span class="True">       3:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="macros_noref.html#_UHlfTUVNT1JZT0JKRUNUX0hfMA__"><span class="b">Py_MEMORYOBJECT_H</span></a>
<a name="4" /><span class="True">       4:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlfTUVNT1JZT0JKRUNUX0hfMA__"><span class="b">Py_MEMORYOBJECT_H</span></a>
<a name="5" /><span class="False">       5:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">__cplusplus</span>
<a name="6" /><span class="False">       6:</span> <span class="m">extern</span> <span class="e">&quot;C&quot;</span> <span class="f">{</span>
<a name="7" /><span class="True">       7:</span> <span class="f">#</span><span class="n">endif</span>
<a name="8" /><span class="True">       8:</span> 
<a name="9" /><span class="True">       9:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="10" /><span class="True">      10:</span> <a href="macros_ref.html#_UHlBUElfREFUQV8w"><span class="b">PyAPI_DATA</span></a><span class="f">(</span><span class="b">PyTypeObject</span><span class="f">)</span> <span class="b">_PyManagedBuffer_Type</span><span class="f">;</span>
<a name="11" /><span class="True">      11:</span> <span class="f">#</span><span class="n">endif</span>
<a name="12" /><span class="True">      12:</span> <a href="macros_ref.html#_UHlBUElfREFUQV8w"><span class="b">PyAPI_DATA</span></a><span class="f">(</span><span class="b">PyTypeObject</span><span class="f">)</span> <span class="b">PyMemoryView_Type</span><span class="f">;</span>
<a name="13" /><span class="True">      13:</span> 
<a name="14" /><span class="True">      14:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlNZW1vcnlWaWV3X0NoZWNrXzA_"><span class="b">PyMemoryView_Check</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><a href="macros_ref.html#_UHlfVFlQRV8w"><span class="b">Py_TYPE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">==</span> <span class="f">&amp;</span><span class="b">PyMemoryView_Type</span><span class="f">)</span>
<a name="15" /><span class="True">      15:</span> 
<a name="16" /><span class="True">      16:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="17" /><span class="True">      17:</span> <span class="k">/* Get a pointer to the memoryview&apos;s private copy of the exporter&apos;s buffer. */</span>
<a name="18" /><span class="True">      18:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlNZW1vcnlWaWV3X0dFVF9CVUZGRVJfMA__"><span class="b">PyMemoryView_GET_BUFFER</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><span class="f">&amp;</span><span class="f">(</span><span class="f">(</span><span class="b">PyMemoryViewObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">view</span><span class="f">)</span>
<a name="19" /><span class="True">      19:</span> <span class="k">/* Get a pointer to the exporting object (this may be NULL!). */</span>
<a name="20" /><span class="True">      20:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_UHlNZW1vcnlWaWV3X0dFVF9CQVNFXzA_"><span class="b">PyMemoryView_GET_BASE</span></a><span class="f">(</span><span class="b">op</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">PyMemoryViewObject</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="b">op</span><span class="f">)</span><span class="f">)</span><span class="f">-&gt;</span><span class="b">view</span><span class="f">.</span><span class="b">obj</span><span class="f">)</span>
<a name="21" /><span class="True">      21:</span> <span class="f">#</span><span class="n">endif</span>
<a name="22" /><span class="True">      22:</span> 
<a name="23" /><span class="True">      23:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyMemoryView_FromObject</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="b">base</span><span class="f">)</span><span class="f">;</span>
<a name="24" /><span class="True">      24:</span> <span class="f">#</span><span class="n">if</span> <span class="f">!</span><span class="b">defined</span><span class="f">(</span><span class="b">Py_LIMITED_API</span><span class="f">)</span> <span class="f">||</span> <span class="b">Py_LIMITED_API</span><span class="f">+</span><span class="c">0</span> <span class="f">&gt;=</span> <span class="c">0x03030000</span>
<a name="25" /><span class="True">      25:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyMemoryView_FromMemory</span><span class="f">(</span><span class="m">char</span> <span class="f">*</span><span class="b">mem</span><span class="f">,</span> <span class="b">Py_ssize_t</span> <span class="b">size</span><span class="f">,</span>
<a name="26" /><span class="True">      26:</span>                                                <span class="m">int</span> <span class="b">flags</span><span class="f">)</span><span class="f">;</span>
<a name="27" /><span class="True">      27:</span> <span class="f">#</span><span class="n">endif</span>
<a name="28" /><span class="True">      28:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="29" /><span class="True">      29:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyMemoryView_FromBuffer</span><span class="f">(</span><span class="b">Py_buffer</span> <span class="f">*</span><span class="b">info</span><span class="f">)</span><span class="f">;</span>
<a name="30" /><span class="True">      30:</span> <span class="f">#</span><span class="n">endif</span>
<a name="31" /><span class="True">      31:</span> <a href="macros_ref.html#_UHlBUElfRlVOQ18w"><span class="b">PyAPI_FUNC</span></a><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="f">)</span> <span class="b">PyMemoryView_GetContiguous</span><span class="f">(</span><span class="b">PyObject</span> <span class="f">*</span><span class="b">base</span><span class="f">,</span>
<a name="32" /><span class="True">      32:</span>                                                   <span class="m">int</span> <span class="b">buffertype</span><span class="f">,</span>
<a name="33" /><span class="True">      33:</span>                                                   <span class="m">char</span> <span class="b">order</span><span class="f">)</span><span class="f">;</span>
<a name="34" /><span class="True">      34:</span> 
<a name="35" /><span class="True">      35:</span> 
<a name="36" /><span class="True">      36:</span> <span class="k">/* The structs are declared here so that macros can work, but they shouldn&apos;t</span>
<a name="37" /><span class="True">      37:</span> <span class="k">   be considered public. Don&apos;t access their fields directly, use the macros</span>
<a name="38" /><span class="True">      38:</span> <span class="k">   and functions instead! */</span>
<a name="39" /><span class="True">      39:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">Py_LIMITED_API</span>
<a name="40" /><span class="True">      40:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01BTkFHRURfQlVGRkVSX1JFTEVBU0VEXzA_"><span class="b">_Py_MANAGED_BUFFER_RELEASED</span></a>    <span class="c">0x001</span>  <span class="k">/* access to exporter blocked */</span>
<a name="41" /><span class="True">      41:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01BTkFHRURfQlVGRkVSX0ZSRUVfRk9STUFUXzA_"><span class="b">_Py_MANAGED_BUFFER_FREE_FORMAT</span></a> <span class="c">0x002</span>  <span class="k">/* free format */</span>
<a name="42" /><span class="True">      42:</span> <span class="m">typedef</span> <span class="m">struct</span> <span class="f">{</span>
<a name="43" /><span class="True">      43:</span>     <a href="macros_ref.html#_UHlPYmplY3RfSEVBRF8w"><span class="b">PyObject_HEAD</span></a>
<a name="44" /><span class="True">      44:</span>     <span class="m">int</span> <span class="b">flags</span><span class="f">;</span>          <span class="k">/* state flags */</span>
<a name="45" /><span class="True">      45:</span>     <span class="b">Py_ssize_t</span> <span class="b">exports</span><span class="f">;</span> <span class="k">/* number of direct memoryview exports */</span>
<a name="46" /><span class="True">      46:</span>     <span class="b">Py_buffer</span> <span class="b">master</span><span class="f">;</span> <span class="k">/* snapshot buffer obtained from the original exporter */</span>
<a name="47" /><span class="True">      47:</span> <span class="f">}</span> <span class="b">_PyManagedBufferObject</span><span class="f">;</span>
<a name="48" /><span class="True">      48:</span> 
<a name="49" /><span class="True">      49:</span> 
<a name="50" /><span class="True">      50:</span> <span class="k">/* memoryview state flags */</span>
<a name="51" /><span class="True">      51:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01FTU9SWVZJRVdfUkVMRUFTRURfMA__"><span class="b">_Py_MEMORYVIEW_RELEASED</span></a>    <span class="c">0x001</span>  <span class="k">/* access to master buffer blocked */</span>
<a name="52" /><span class="True">      52:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01FTU9SWVZJRVdfQ18w"><span class="b">_Py_MEMORYVIEW_C</span></a>           <span class="c">0x002</span>  <span class="k">/* C-contiguous layout */</span>
<a name="53" /><span class="True">      53:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01FTU9SWVZJRVdfRk9SVFJBTl8w"><span class="b">_Py_MEMORYVIEW_FORTRAN</span></a>     <span class="c">0x004</span>  <span class="k">/* Fortran contiguous layout */</span>
<a name="54" /><span class="True">      54:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01FTU9SWVZJRVdfU0NBTEFSXzA_"><span class="b">_Py_MEMORYVIEW_SCALAR</span></a>      <span class="c">0x008</span>  <span class="k">/* scalar: ndim = 0 */</span>
<a name="55" /><span class="True">      55:</span> <span class="f">#</span><span class="n">define</span> <a href="macros_noref.html#_X1B5X01FTU9SWVZJRVdfUElMXzA_"><span class="b">_Py_MEMORYVIEW_PIL</span></a>         <span class="c">0x010</span>  <span class="k">/* PIL-style layout */</span>
<a name="56" /><span class="True">      56:</span> 
<a name="57" /><span class="True">      57:</span> <span class="m">typedef</span> <span class="m">struct</span> <span class="f">{</span>
<a name="58" /><span class="True">      58:</span>     <a href="macros_ref.html#_UHlPYmplY3RfVkFSX0hFQURfMA__"><span class="b">PyObject_VAR_HEAD</span></a>
<a name="59" /><span class="True">      59:</span>     <span class="b">_PyManagedBufferObject</span> <span class="f">*</span><span class="b">mbuf</span><span class="f">;</span> <span class="k">/* managed buffer */</span>
<a name="60" /><span class="True">      60:</span>     <span class="b">Py_hash_t</span> <span class="b">hash</span><span class="f">;</span>               <span class="k">/* hash value for read-only views */</span>
<a name="61" /><span class="True">      61:</span>     <span class="m">int</span> <span class="b">flags</span><span class="f">;</span>                    <span class="k">/* state flags */</span>
<a name="62" /><span class="True">      62:</span>     <span class="b">Py_ssize_t</span> <span class="b">exports</span><span class="f">;</span>           <span class="k">/* number of buffer re-exports */</span>
<a name="63" /><span class="True">      63:</span>     <span class="b">Py_buffer</span> <span class="b">view</span><span class="f">;</span>               <span class="k">/* private copy of the exporter&apos;s view */</span>
<a name="64" /><span class="True">      64:</span>     <span class="b">PyObject</span> <span class="f">*</span><span class="b">weakreflist</span><span class="f">;</span>
<a name="65" /><span class="True">      65:</span>     <span class="b">Py_ssize_t</span> <span class="b">ob_array</span><span class="f">[</span><span class="c">1</span><span class="f">]</span><span class="f">;</span>       <span class="k">/* shape, strides, suboffsets */</span>
<a name="66" /><span class="True">      66:</span> <span class="f">}</span> <span class="b">PyMemoryViewObject</span><span class="f">;</span>
<a name="67" /><span class="True">      67:</span> <span class="f">#</span><span class="n">endif</span>
<a name="68" /><span class="True">      68:</span> 
<a name="69" /><span class="False">      69:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">__cplusplus</span>
<a name="70" /><span class="False">      70:</span> <span class="f">}</span>
<a name="71" /><span class="True">      71:</span> <span class="f">#</span><span class="n">endif</span>
<a name="72" /><span class="True">      72:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !Py_MEMORYOBJECT_H */</span>
<a name="73" /><span class="True">      73:</span> </pre>
  </body>
</html>
